package com.yjyw.tiexie.util;

import android.text.TextUtils;
import android.widget.Toast;

import com.yjyw.tiexie.application.MyApplication;


public class ToastUtil {
    private static Toast mToast;

    public static void show(String msg) {
        if (TextUtils.isEmpty(msg)) {
            return;
        }

        if (mToast == null) {
            mToast = Toast.makeText(MyApplication.getContext(), msg, Toast.LENGTH_SHORT);
        } else {
            mToast.setText(msg);
            mToast.setDuration(Toast.LENGTH_SHORT);
        }
        mToast.show();
    }


    public static void cancelToast() {
        if (mToast != null) {
            mToast.cancel();
        }
    }
}
